package com.douqu.game.core.entity.ext;

import com.bean.core.buffer.ByteBuffer;
import com.douqu.game.core.entity.WorldInfo;
import com.douqu.game.core.entity.sprite.Player;

import java.io.Serializable;
//import java.util.logging.Logger;

/**
 * Created by bean on 2017/7/17.
 */
public abstract class ExtInfo implements Serializable
{

//    Logger logger = Logger.getLogger(this.getClass().getSimpleName());

    protected static final long serialVersionUID = 1L;

    protected Player player;

    protected WorldInfo worldInfo;

    public ExtInfo(Player player, WorldInfo worldInfo){
        this.player = player;
        this.worldInfo = worldInfo;
    }

    public String getName()
    {
        return this.getClass().getSimpleName();
    }

    public void init(){}

    public void writeTo(ByteBuffer buffer){}

    public void loadFrom(ByteBuffer buffer){}

    public byte[] getData()
    {
        ByteBuffer buffer = new ByteBuffer();
        writeTo(buffer);

        return buffer.getBytes();
    }

}
